package edu.zhuravlev.trainingbot.it;


import edu.zhuravlev.trainingbot.dispatcher.BotDispatcher;
import edu.zhuravlev.trainingbot.it.config.TestConfig;
import io.zonky.test.db.AutoConfigureEmbeddedDatabase;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.test.context.ActiveProfiles;
import org.telegram.telegrambots.meta.api.objects.Update;
import org.telegram.telegrambots.meta.generics.TelegramClient;

import static io.zonky.test.db.AutoConfigureEmbeddedDatabase.RefreshMode.AFTER_EACH_TEST_METHOD;


@SpringBootTest(classes = TestConfig.class)
@ActiveProfiles("test")
@AutoConfigureEmbeddedDatabase(refresh = AFTER_EACH_TEST_METHOD)
public abstract class RootIT {

    @Autowired
    private BotDispatcher botDispatcher;

    @Autowired
    protected TelegramClient telegramClient;

    protected void receivedUpdate(Update update) {
        botDispatcher.consume(update);
    }

}
